package com.sailing.xjpb.ipaas.client.core.repository;

import com.sailing.xjpb.ipaas.client.core.IpaasHttpClient;
import com.sailing.xjpb.ipaas.client.entity.dto.SipUserMenuDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;

import java.util.List;

/**
 * 菜单信息
 *
 * @author luozy
 * Created time 2021/3/23
 */
public class SipMenuRepository {

    @Autowired
    private IpaasHttpClient httpClient;

    public SipUserMenuDTO getSipUserMenu(String userCode, String systemId) {
        String url = "/external-interface/userContext/findMenuByUserNameAndSystemId/" + userCode + "/" + systemId;
        List<SipUserMenuDTO> rsList = httpClient.list(url, HttpMethod.GET, SipUserMenuDTO.class);
        return rsList != null ? rsList.get(0) : null;
    }

}
